import React, { Component } from 'react';
import ReactDom from 'react-dom';
import util from "@/common/util";
import layer from "@/common/layer";
import axios from 'axios';
import ReactSwiper from 'reactjs-swiper';
// import $ from 'jquery';


class Loan extends Component {
    constructor(props) {
        super(props);
        this.state = {
            bankList: []
        }
    }

    componentDidMount() {
        this.getBanklist()
    }

    async getBanklist() {
        let res = await util.rjax({
            url: '/bank/list',
            type: 'get',
        })
        this.setState({ bankList: res.data });
    }

    render() {
        //方式1:

        let loans = this.state.bankList.map((item, index) => {
            return (

                <li data-id={item.id} key={index}>
                    <a href={"./cardlist.html?id=" + item.id}>
                        <img className="iconimg" src={item.logo} alt="" />
                        <div className="loandel">
                            <p className="loanname">{item.name}</p>
                            <p className="advance">{item.remark}</p>
                        </div>
                        <span className="entericon"><img src="/assets/wechat/arrow.png" alt="" /></span>
                    </a>
                </li>
            )
        })
        return (
            <div>
                <div id="loan">
                    <ul>
                        {loans}
                    </ul>
                </div>
            </div>
        )
    }
}
ReactDom.render(<Loan />, document.getElementById("app"));